import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const moduleA = {
	state: {
		zhuangtai: true
	},
	mutations: {
		changeystate(state) {
			state.zhuangtai = true
			console.log(state.zhuangtai)
		},
		changenstate(state) {
			state.zhuangtai = false
		}
	},
	actions: {
		changeystate: ({
			commit
		}) => commit('changeystate'), // 提交到mutations中处理
		changenstate: ({
			commit
		}) => commit('changenstate')
	},
	getters: {

	}
}

const moduleB = {
	state: {
		count: 0
	},
	mutations: {
		increment(state) {
			state.count = state.count + 5
		},
		decrement(state) {
			state.count = state.count - 3
		}
	},
	actions: {
		increment: ({
			commit
		}) => commit('increment'), // 提交到mutations中处理
		decrement: ({
			commit
		}) => commit('decrement')
	},
	getters: {

	}
}

export default new Vuex.Store({
	modules: {
		a: moduleA,
		b: moduleB
	}
})